<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="#op/coupon_tmpl/">红包模板管理</a>
            </li>
        </ol>
    </div>
    <div class="topbar-right">
        <a href="#op/coupon_tmpl/add/" class="btn btn-default btn-sm light fw600 ml10"><span class="fa fa-plus pr5"></span>新建红包模板</a>
        <div class="ml15 ib va-m" id="toggle_sidemenu_r">
            <a href="#" class="pl5"> <i class="fa fa-sign-in fs22 text-primary"></i>
            </a>
        </div>
    </div>
</header>

<section id="content" class="animated fadeIn">
    <div class="panel overflow" >
        <table class="table table-striped fs13" id="main-list">
            <thead>
                <tr class="bg-light">
                    <th class="sortable" data-field="id">ID</th>
                    <th>分类</th>
                    <th>标题</th>
                    <th class="">描述</th>
                    <th class="sortable" data-field="price">金额</th>
                    <th class="sortable" data-field="condition_price">条件金额</th>
                    <th class="">有效期</th>
                    <th class="sortable" data-field="updated_at">最后更新时间</th>
                    <th class="">操作</th>
                </tr>
            </thead>
            <tbody class="admin-form">
                <% _.each(items, function(item){
                    var moment = require('moment');
                    var d = moment.duration(item.valid_ts, 'seconds').humanize();
                    if(item.valid_ts == 0) d='当天';
                %>
                    <tr data-id="<%= item.id %>" >
                        <td class=""><a href="#op/coupon_tmpl/<%= item.id %>/" ><%= item.id %></a></td>
                        <td class=""><%= COUPON_TYPE[item.coupon_type] %></td>
                        <td><%= item.title %></td>
                        <td class=""><%= item.desc %></td>
                        <td class=""><%= item.price %></td>
                        <td class=""><%= item.condition_price || 0 %></td>
                        <td class=""><%= d %></td>
                        <td class=""><%= item.updated_at %></td>
                        <td class="text-left">
                            <a class="glyphicons glyphicons-pencil" href="#op/coupon_tmpl/<%= item.id %>/"></a>
                            <!-- <a class="glyphicons glyphicons-remove_2 onClickDelete" href="javascript:;"></a> -->
                        </td>
                    </tr>
                <% }) %>
            </tbody>
        </table>
    </div>
    <div><div class="pull-left" id="page-tips"></div><div id="paginator"></div></div>
</section>

<!-- Start: Right Sidebar -->
<aside id="sidebar_right" class="nano">
    <div class="p20 admin-form">

        <h4 class="mt5 text-muted fw500">过滤条件：</h4>

        <hr class="short">

        <div class="section mb15">
            <label  class="field prepend-icon">
                <input title="模板ID或名称" type="text" data-field="id" data-useless="" class="gui-input" placeholder="模板ID或名称" value="<%= searched.id  %>">
                <label class="field-icon"><i class="fa fa-tag"></i>
                </label>
            </label>
        </div>

        <h6 class="fw400">红包类型</h6>
        <div class="section mb15">
            <label class="field select">
                <select data-field="coupon_type" data-useless="-1" data-type="int">
                    <option value="-1" <%= searched.coupon_type == -1 ? 'selected' : '' %>>所有</option>
                    <% _.each(COUPON_TYPE, function(v, k){ %>
                        <option value="<%= k %>" <%= searched.coupon_type == k ? "selected" : "" %>><%= v %></option>
                    <% }) %>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>

        <hr class="short">

        <button class="btn btn-default btn-block" type="button" id="search">搜索</button>

    </div>
</aside>
<!-- End: Right Sidebar -->
